import request from "@/utils/http"

export function getPostList() {
  return request({
    url: "/system/post/list",
    method: "get",
    params: {}
  })
}

//添加
export function addPostFn(data) {
  if (typeof data.flag === "string") {
    data.flag = data.flag === "1"; // 将 "1" 转换为 true，"0" 转换为 false
  }
  return request({
    url: "/system/post",
    method: "post",
    data,
  });
}
//修改
export function editPutFn(data) {
  if (typeof data.flag === "string") {
    data.flag = data.flag === "1"; // 将 "1" 转换为 true，"0" 转换为 false
  }
  return request({
    url: "/system/post",
    method: "put",
    data,
  });
}
//删除
export function deletePostFn(id) {
  return request({
    url: "/system/post/" + id,
    method: "delete",
  })
}
//搜索
export function searchPostFn(params) {
  return request({
    url: "/system/post/list",
    method: "get",
    params
  })
}